# -*- coding: utf-8 -*-
# author yzs
# date 2019-01-14
#
# 字符串3
# Description
# Given a text txt[0..n-1] and a pattern pat[0..m-1], write a function search(char pat[], char txt[])
# that prints all occurrences of pat[] in txt[]. You may assume that n > m.
# Input
# 输入第一行是用例个数，后面一行表示一个用例；用例包括两部分，第一部分为给定文本，第二部分为搜索串，两部分使用","隔开。
# Output
# 每一个用例输出一行，每行按照找到的位置先后顺序排列，使用空格隔开。
# Sample Input 1 
# 2
# THIS IS A TEST TEXT,TEST
# AABAACAADAABAABA,AABA
# Sample Output 1
# 10
# 0 9 12


def search(pat, txt):
    pat_len = len(pat)
    txt_len = len(txt)
    result = []
    for i in range(txt_len - pat_len + 1):
        j = 0
        for j in range(0, pat_len):
            if txt[i + j] != pat[j]:
                break
        if j == pat_len - 1:
            result.append(i)
    print(" ".join(str(m) for m in result))


while True:
    try:
        t = int(input().strip())
        for i in range(t):
            data = input().strip().split(",")
            txt, pat = data[0], data[1]
            search(pat, txt)
    except EOFError:
        break
